home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / u_man / cat1 / edit.z / edit
Encoding:
Text File  |  2002-10-03  |  12.1 KB  |  199 lines

  1.  
  2.  
  3.  
  4. eeeeddddiiiitttt((((1111))))                                                                eeeeddddiiiitttt((((1111))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      edit - text editor (variant of ex for casual users)
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      eeeeddddiiiitttt [----rrrr] [----xxxx] [----CCCC] _n_a_m_e ...
  13.  
  14. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  15.      _e_d_i_t is a variant of the text editor _e_x recommended for new or casual
  16.      users who wish to use a command-oriented editor.  It operates precisely
  17.      as _e_x(1) with the following options automatically set:
  18.  
  19.      novice     ON
  20.      report     ON
  21.      showmode   ON
  22.      magic      OFF
  23.  
  24.      These options can be turned on or off via the sssseeeetttt command in _e_x(1).
  25.  
  26.      ----rrrr   Recover file after an editor or system crash.
  27.  
  28.      ----xxxx   Encryption option; when used the file is encrypted as it is being
  29.           written and requires an encryption key to be read.  _e_d_i_t makes an
  30.           educated guess to determine if a file is encrypted or not.  See
  31.           _c_r_y_p_t(1).  Also, see the WWWWAAAARRRRNNNNIIIINNNNGGGG section at the end of this
  32.           reference page.
  33.  
  34.      ----CCCC   Encryption option; the same as ----xxxx except that _e_d_i_t assumes files are
  35.           encrypted.
  36.  
  37.      The following brief introduction should help you get started with _e_d_i_t.
  38.      If you are using a CRT terminal you may want to learn about the display
  39.      editor _v_i.
  40.  
  41.      To edit the contents of an existing file you begin with the command eeeeddddiiiitttt
  42.      _n_a_m_e to the shell.  _e_d_i_t makes a copy of the file that you can edit and
  43.      tells you how many lines and characters are in the file.  To create a new
  44.      file, you also begin with the command eeeeddddiiiitttt with a filename:  eeeeddddiiiitttt _n_a_m_e;
  45.      the editor tells you it is a _[[[[_NNNN_eeee_wwww _FFFF_iiii_llll_eeee_]]]].
  46.  
  47.      The _e_d_i_t command prompt is the colon (::::), which you should see after
  48.      starting the editor.  If you are editing an existing file, you have some
  49.      lines in _e_d_i_t's buffer (its name for the copy of the file you are
  50.      editing).  When you start editing, _e_d_i_t makes the last line of the file
  51.      the current line.  Most commands to _e_d_i_t use the current line if you do
  52.      not tell them which line to use.  Thus if you say pppprrrriiiinnnntttt (which can be
  53.      abbreviated pppp) and type carriage return (as you should after all _e_d_i_t
  54.      commands), the current line is printed.  If you ddddeeeelllleeeetttteeee (dddd) the current
  55.      line, _e_d_i_t prints the new current line, which is usually the next line in
  56.      the file.  If you ddddeeeelllleeeetttteeee the last line, the new last line becomes the
  57.      current one.
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. eeeeddddiiiitttt((((1111))))                                                                eeeeddddiiiitttt((((1111))))
  71.  
  72.  
  73.  
  74.      If you start with an empty file or wish to add some new lines, the aaaappppppppeeeennnndddd
  75.      (aaaa) command can be used.  After you execute this command (typing a
  76.      carriage return after the word aaaappppppppeeeennnndddd), _e_d_i_t reads lines from your
  77.      terminal until you type a line consisting of just a dot (....); it places
  78.      these lines after the current line.  The last line you type becomes the
  79.      current line.  The command iiiinnnnsssseeeerrrrtttt (iiii) is like aaaappppppppeeeennnndddd, but places the
  80.      lines you type before, rather than after, the current line.
  81.  
  82.      _e_d_i_t numbers the lines in the buffer, with the first line having number
  83.      1.  If you execute the command 1111, _e_d_i_t types the first line of the
  84.      buffer.  If you then execute the command dddd, _e_d_i_t deletes the first line,
  85.      line 2 becomes line 1, and _e_d_i_t prints the current line (the new line 1)
  86.      so you can see where you are.  In general, the current line is always the
  87.      last line affected by a command.
  88.  
  89.      You can make a change to some text within the current line by using the
  90.      ssssuuuubbbbssssttttiiiittttuuuutttteeee (ssss) command:  ssss/_o_l_d/_n_e_w/ where _o_l_d is the string of characters
  91.      you want to replace and _n_e_w is the string of characters you want to
  92.      replace _o_l_d with.
  93.  
  94.      The command ffffiiiilllleeee (ffff) tells you how many lines there are in the buffer you
  95.      are editing and says _[[[[_MMMM_oooo_dddd_iiii_ffff_iiii_eeee_dddd_]]]] if you have changed the buffer.  After
  96.      modifying a file, you can save the contents of the file by executing a
  97.      wwwwrrrriiiitttteeee (wwww) command.  You can leave the editor by issuing a qqqquuuuiiiitttt (qqqq)
  98.      command.  If you run _e_d_i_t on a file, but do not change it, it is not
  99.      necessary (but does no harm) to wwwwrrrriiiitttteeee the file back.  If you try to qqqquuuuiiiitttt
  100.      from _e_d_i_t after modifying the buffer without writing it out, you receive
  101.      the message _NNNN_oooo _wwww_rrrr_iiii_tttt_eeee _ssss_iiii_nnnn_cccc_eeee _llll_aaaa_ssss_tttt _cccc_hhhh_aaaa_nnnn_gggg_eeee _((((_::::_qqqq_uuuu_iiii_tttt_!!!! _oooo_vvvv_eeee_rrrr_rrrr_iiii_dddd_eeee_ssss_)))), and _e_d_i_t waits
  102.      for another command.  If you do not want to write the buffer out, issue
  103.      the qqqquuuuiiiitttt command followed by an exclamation point (qqqq!!!!).  The buffer is
  104.      irretrievably discarded and you return to the shell.
  105.  
  106.      By using the dddd and aaaa commands and giving line numbers to see lines in the
  107.      file, you can make any changes you want.  You should learn at least a few
  108.      more things, however, if you will use _e_d_i_t more than a few times.
  109.  
  110.      The cccchhhhaaaannnnggggeeee (cccc) command changes the current line to a sequence of lines
  111.      you supply (as in aaaappppppppeeeennnndddd, you type lines up to a line consisting of only
  112.      a dot (....).  You can tell cccchhhhaaaannnnggggeeee to change more than one line by giving
  113.      the line numbers of the lines you want to change, that is, 3333,,,,5555cccc.  You can
  114.      print lines this way too:  1111,,,,22223333pppp prints the first 23 lines of the file.
  115.  
  116.      The uuuunnnnddddoooo (uuuu) command reverses the effect of the last command you executed
  117.      that changed the buffer.  Thus if you execute a ssssuuuubbbbssssttttiiiittttuuuutttteeee command that
  118.      does not do what you want, type uuuu and the old contents of the line are
  119.      restored.  You can also uuuunnnnddddoooo an uuuunnnnddddoooo command.  _e_d_i_t gives you a warning
  120.      message when a command affects more than one line of the buffer.  Note
  121.      that commands such as wwwwrrrriiiitttteeee and qqqquuuuiiiitttt cannot be undone.
  122.  
  123.      To look at the next line in the buffer, type carriage return.  To look at
  124.      a number of lines, type ^^^^DDDD (while holding down the control key, press dddd)
  125.      rather than carriage return.  This shows you a half-screen of lines on a
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. eeeeddddiiiitttt((((1111))))                                                                eeeeddddiiiitttt((((1111))))
  137.  
  138.  
  139.  
  140.      CRT or 12 lines on a hardcopy terminal.  You can look at nearby text by
  141.      executing the zzzz command.  The current line appears in the middle of the
  142.      text displayed, and the last line displayed becomes the current line; you
  143.      can get back to the line where you were before you executed the zzzz command
  144.      by typing ''''''''.  The zzzz command has other options:  zzzz---- prints a screen of
  145.      text (or 24 lines) ending where you are; zzzz++++ prints the next screenful.
  146.      If you want less than a screenful of lines, type zzzz....11111111 to display five
  147.      lines before and  five lines after the current line.  (Typing zzzz...._n, when _n
  148.      is an odd number, displays a total of _n lines, centered about the current
  149.      line; when _n is an even number, it displays _n-1 lines, so that the lines
  150.      displayed are centered around the current line.)  You can give counts
  151.      after other commands; for example, you can delete 5 lines starting with
  152.      the current line with the command dddd5555 ....
  153.  
  154.      To find things in the file, you can use line numbers if you happen to
  155.      know them; since the line numbers change when you insert and delete lines
  156.      this is somewhat unreliable.  You can search backwards and forwards in
  157.      the file for strings by giving commands of the form /_t_e_x_t/ to search
  158.      forward for _t_e_x_t or ?_t_e_x_t?  to search backward for _t_e_x_t . If a search
  159.      reaches the end of the file without finding _t_e_x_t, it wraps around and
  160.      continues to search back to the line where you are.  A useful feature
  161.      here is a search of the form /^_t_e_x_t/ which searches for _t_e_x_t at the
  162.      beginning of a line.  Similarly /_t_e_x_t$/ searches for _t_e_x_t at the end of a
  163.      line.  You can leave off the trailing //// or ???? in these commands.
  164.  
  165.      The current line has the symbolic name dot (....); this is most useful in a
  166.      range of lines as in ....,,,,$$$$pppp which prints the current line plus the rest of
  167.      the lines in the file.  To move to the last line in the file, you can
  168.      refer to it by its symbolic name $.  Thus the command $$$$dddd deletes the last
  169.      line in the file, no matter what the current line is.  Arithmetic with
  170.      line references is also possible.  Thus the line $$$$----5555 is the fifth before
  171.      the last and ....++++22220000 is 20 lines after the current line.
  172.  
  173.      You can find out the current line by typing ....====.  This is useful if you
  174.      wish to move or copy a section of text within a file or between files.
  175.      Find the first and last line numbers you wish to copy or move.  To move
  176.      lines 10 through 20, type 11110000,,,,22220000dddd aaaa to delete these lines from the file
  177.      and place them in a buffer named aaaa.  _e_d_i_t has 26 such buffers named aaaa
  178.      through zzzz.  To put the contents of buffer aaaa after the current line, type
  179.      ppppuuuutttt aaaa.  If you want to move or copy these lines to another file, execute
  180.      an eeeeddddiiiitttt (eeee) command after copying the lines; following the eeee command with
  181.      the name of the other file you wish to edit, that is, eeeeddddiiiitttt cccchhhhaaaapppptttteeeerrrr2222.  To
  182.      copy lines without deleting them, use yyyyaaaannnnkkkk (yyyy) in place of dddd.  If the
  183.      text you wish to move or copy is all within one file, it is not necessary
  184.      to use named buffers.  For example, to move lines 10 through 20 to the
  185.      end of the file, type 11110000,,,,22220000mmmm $$$$.
  186.  
  187. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  188.      ed(1), ex(1), vi(1).
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.